package com.itheima.网络编程.udp编程;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class UdpClient1x {
    public static void main(String[] args) throws IOException {
        while (true) {
            DatagramSocket ds=new DatagramSocket();
            String s="客户端发送的数据";
            byte[] bys=s.getBytes();
            InetAddress address=InetAddress.getByName("255.255.255.255");
            int port=10331;
            DatagramPacket dgp=new DatagramPacket(bys,bys.length,address,port);
            ds.send(dgp);
            ds.close();
        }
    }
}
